package day_2022_12_to_3.year2023;

/**
 * @author haomin
 * @date 2023/03/01 21:20
 **/
public class Day3_1_Num2373 {
    class Solution {
        public int[][] largestLocal(int[][] grid) {
            int n = grid.length;
            int[][] g = new int[n-2][n-2], g_ = new int[n-2][n];
            for(int i=1; i<n-1; i++){
                for(int j=0; j<n; j++){
                    g_[i-1][j] = Math.max(grid[i-1][j],Math.max(grid[i][j],grid[i+1][j]));
                }
            }
            for(int i=0; i<n-2; i++){
                for(int j=1; j<n-1; j++){
                    g[i][j-1] = Math.max(g_[i][j-1],Math.max(g_[i][j],g_[i][j+1]));
                }
            }
            return g;
        }
    }
}